<template>
    <div id="left-top-bar" style="width: 100%; height: 430px"></div>
</template>
<script lang="ts">
import { defineComponent, onMounted } from 'vue'

import echarts from '@/echarts'

import { option } from './constant'
import { resObject } from '../../constant'

export default defineComponent({
    name: 'LeftTopBar',
    setup() {
        const constant = {
            option
        }
        onMounted(() => {
            constant.option.series[0].data = resObject.povertyComposition.map((el: any) => {
                return {
                    value: el.value,
                    name: el.label
                }
            })
            echarts.init(document.getElementById('left-top-bar')).setOption(constant.option)
        })

        return {
            ...constant
        }
    }
})
</script>
